Scalable lossless audio codec and authoring tool

ABSTRACT

An audio codec losslessly encodes audio data into a sequence of analysis windows in a scalable bitstream. This is suitably done by separating the audio data into MSB and LSB portions and encoding each with a different lossless algorithm. An authoring tool compares the buffered payload to an allowed payload for each window and selectively scales the losslessly encoded audio data, suitably the LSB portion, in the non-conforming windows to reduce the encoded payload, hence buffered payload. This approach satisfies the media bit rate and buffer capacity constraints without having to filter the original audio data, reencode or otherwise disrupt the lossless bitstream.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims benefit of priority under 35 U.S.C. 119(e) toU.S. Priority application Ser. No. 11/891,905 entitled “SCALABLELOSSLESS AUDIO CODEC AND AUTHORING TOOL” filed on Aug. 14, 2007, theentire contents of which are incorporated by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to lossless audio codecs and more specifically toa scalable lossless audio codec and authoring tool.

2. Description of the Related Art

Numbers of low bit-rate lossy audio coding systems are currently in usein a wide range of consumer and professional audio playback products andservices. For example, Dolby AC3 (Dolby digital) audio coding system isa world-wide standard for encoding stereo and 5.1 channel audio soundtracks for Laser Disc, NTSC coded DVD video, and ATV, using bit rates upto 640 kbit/s. MPEG I and MPEG II audio coding standards are widely usedfor stereo and multi-channel sound track encoding for PAL encoded DVDvideo, terrestrial digital radio broadcasting in Europe and Satellitebroadcasting in the US, at bit rates up to 768 kbit/s. DTS (DigitalTheater Systems) Coherent Acoustics audio coding system is frequentlyused for studio quality 5.1 channel audio sound tracks for Compact Disc,DVD video, Satellite Broadcast in Europe and Laser Disc and bit rates upto 1536 kbit/s.

An improved codec offering 96 kHz bandwidth and 24 bit resolution isdisclosed in U.S. Pat. No. 6,226,616 (also assigned to Digital TheaterSystems, Inc.). That patent employs a core and extension methodology inwhich the traditional audio coding algorithm constitutes the ‘core’audio coder, and remains unaltered. The audio data necessary torepresent higher audio frequencies (in the case of higher samplingrates) or higher sample resolution (in the case of larger word lengths),or both, is transmitted as an ‘extension’ stream. This allows audiocontent providers to include a single audio bit stream that iscompatible with different types of decoders resident in the consumerequipment base. The core stream will be decoded by the older decoderswhich will ignore the extension data, while newer decoders will make useof both core and extension data streams giving higher quality soundreproduction. However, this prior approach does not provide trulylossless encoding or decoding. Although the system of U.S. Pat. No.6,226,216 provides superior quality audio playback, it does not provide“lossless” performance.

Recently, many consumers have shown interest in these so-called“lossless” codecs. “Lossless” codecs rely on algorithms which compressdata without discarding any information. As such, they do not employpsychoacoustic effects such as “masking”. A lossless codec produces adecoded signal which is identical to the (digitized) source signal. Thisperformance comes at a cost: such codecs typically require morebandwidth than lossy codecs, and compress the data to a lesser degree.

The lack of compression can cause a problem when content is beingauthored to a disk, CD, DVD, etc., particularly in cases of highlyun-correlated source material or very large source bandwidthrequirements. The optical properties of the media establish a peak bitrate for all content that can not be exceeded. As shown in FIG. 1, ahard threshold 10, e.g., 9.6 Mbps for DVD audio, is typicallyestablished for audio so that the total bit rate does not exceed themedia limit.

The audio and other data is laid out on the disk to satisfy the variousmedia constraints and to ensure that all the data that is required todecode a given frame will be present in the audio decoder buffer. Thebuffer has the effect of smoothing the frame-to-frame encoded payload(bit rate) 12, which can fluctuate wildly from frame-to-frame, to createa buffered payload 14, i.e. the buffered average of the frame-to-frameencoded payload. If the buffered payload 14 of the lossless bitstreamfor a given channel exceeds the threshold at any point the audio inputfiles are altered to reduce their information content. The audio filesmay be altered by reducing the bit-depth of one or more channels such asfrom 24-bit to 22-bit, filtering a channel's frequency bandwidth tolow-pass only, or reducing the audio bandwidth such as by filteringinformation above 40 kHz when sampling at 96 kHz. The altered audioinput files are re-encoded so that the payload 16 never exceeds thethreshold 10. An example of this process is described in the SurCodeMLP—Owner's Manual pp. 20-23.

This is a very computationally and time inefficient process.Furthermore, although the audio encoder is still lossless, the amount ofaudio content that is delivered to the user has been reduced over theentire bitstream. Moreover, the alteration process is inexact, if toolittle information is removed the problem may still exist, if too muchinformation is removed audio data is needlessly discarded. In addition,the authoring process will have to be tailored to the specific opticalproperties of the media and the buffer size of the decoder.

SUMMARY OF THE INVENTION

The present invention provides an audio codec that generates a losslessbitstream and an authoring tool that selectively discards bits tosatisfy media, channel, decoder buffer or playback device bit rateconstraints without having to filter the audio input files, reencode orto otherwise disrupt the lossless bitstream.

This is accomplished by losslessly encoding the audio data in a sequenceof analysis windows into a scalable bitstream, comparing the bufferedpayload to an allowed payload for each window, and selectively scalingthe losslessly encoded audio data in the non-conforming windows toreduce the encoded payload, hence the buffered payload therebyintroducing loss.

In an exemplary embodiment, the audio encoder separates the audio datainto most significant bit (MSB) and least significant bit (LSB) portionsand encodes each with a different lossless algorithm. An authoring toolwrites the MSB portions to a bitstream, writes the LSB portions in theconforming windows to the bitstream, and scales the lossless LSBportions of any non-conforming frames to make them conform and writesthe now lossy LSB portions to the bitstream. The audio decoder decodesthe MSB and LSB portions and reassembles the PCM audio data.

The audio encoder splits each audio sample into the MSB and LSBportions, encodes the MSB portion with a first lossless algorithm,encodes the LSB portion with a second lossless algorithm, and packs theencoded audio data into a scalable, lossless bitstream. The boundarypoint between the MSB and LSB portions is suitably established by theenergy and/or maximum amplitude of samples in an analysis window. TheLSB bit widths are packed into the bitstream. The LSB portion ispreferably encoded so that some or all of the LSBs may be selectivelydiscarded. Frequency extensions may be similarly encoded with MSB/LSB orentirely encoded as LSBs.

An authoring tool is used to lay out the encoded data on a disk (media).The initial layout corresponds to the buffered payload. The toolcompares the buffered payload to the allowed payload for each analysiswindow to determine whether the layout requires any modification. Ifnot, all of the lossless MSB and LSB portions of the lossless bitstreamare written to a bitstream and recorded on the disk. If yes, theauthoring tool scales the lossless bitstream to satisfy the constraints.More specifically, the tool writes the lossless MSB and LSB portion forall of the conforming windows and the headers and lossless MSB portionsfor the non-conforming to a modified bitstream. Based on aprioritization rule, for each non-conforming window the authoring toolthen determines how many of the LSBs to discard from each audio samplein the analysis window for one or more audio channels and repacks theLSB portions into the modified bitstream with their modified bit widths.This is repeated for only those analysis windows in which the bufferedpayload exceeds the allowed payload.

A decoder receives the authored bitstream via the media or transmissionchannel. The audio data is directed to a buffer, which does not overflowon account of the authoring, and in turn provides sufficient data to aDSP chip to decode the audio data for the current analysis window. TheDSP chip extracts the header information and extracts, decodes andassembles the MSB portions of the audio data. If all of the LSBs werediscarded during authoring, the DSP chip translates the MSB samples tothe original bit width word and outputs the PCM data. Otherwise, the DSPchip decodes the LSB portions, assembles the MSB & LSB samples,translates the assembled samples to the original bit width word andoutputs the PCM data.

These and other features and advantages of the invention will beapparent to those skilled in the art from the following detaileddescription of preferred embodiments, taken together with theaccompanying drawings, in which:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1, as described above, is a plot of bit rate and payload for alossless audio channel versus time;

FIG. 2 is a block diagram of a lossless audio codec and authoring toolin accordance with the present invention;

FIG. 3 is a simplified flowchart of the audio coder;

FIG. 4 is a diagram of an MSB/LSB split for a sample in the losslessbitstream;

FIG. 5 is a simplified flowchart of the authoring tool;

FIG. 6 is a diagram of an MSB/LSB split for a sample in the authoredbitstreams;

FIG. 7 is a diagram of a bitstream including the MSB and LSB portionsand header information;

FIG. 8 is a plot of payload for the lossless and authored bitstreams;

FIG. 9 is a simple block diagram of an audio decoder;

FIG. 10 is a flowchart of the decoding process;

FIG. 11 is a diagram of an assembled bitstream;

FIGS. 12-15 illustrate the bitstream format, encoding, authoring, anddecoding for a particular embodiment; and

FIGS. 16 a and 16 b are block diagrams of the encoder and decoder for ascalable lossless codec that is backwards compatible with a lossy coreencoder.

DETAILED DESCRIPTION OF THE INVENTION

The present invention provides a lossless audio codec and authoring toolfor selectively discarding bits to satisfy media, channel, decoderbuffer or playback device bit rate constraints without having to filterthe audio input files, reencode or to otherwise disrupt the losslessbitstream.

As shown in FIG. 2, an audio encoder 20 losslessly encodes the audiodata in a sequence of analysis windows and packs the encoded data andheader information into a scalable, lossless bitstream 22, which issuitably stored in an archive 24. The analysis windows are typicallyframes of encoded data but as used herein the windows could span aplurality of frames. Furthermore, the analysis window may be refinedinto one or more segments of data inside a frame, one or more channelsets inside a segment, one or more channels in each channel set andfinally one or more frequency extensions inside a channel. The scalingdecisions for the bitstream can be very coarse (multiple frames) or morerefined (per frequency extension per channel set per frame).

An authoring tool 30 is used to lay out the encoded data on a disk(media) in accordance with the decoder's buffer capacity. The initiallayout corresponds to the buffered payload. The tool compares thebuffered payload to the allowed payload for each analysis window todetermine whether the layout requires any modification. The allowedpayload is typically a function of the peak bit rate supported by amedia (DVD disk) or transmission channel. The allowed payload may befixed or allowed to vary if part of a global optimization. The authoringtool selectively scales the losslessly encoded audio data in thenon-conforming windows to reduce the encoded payload, hence the bufferedpayload. The scaling process introduces some loss into the encoded databut is confined to only the non-conforming windows and is suitably justenough to bring each window into conformance. The authoring tool packsthe lossless and lossy data and any modified header information into abitstream 32. The bitstream 32 is typically stored on a media 34 ortransmitted over a transmission channel 36 for subsequent playback viaan audio decoder 38, which generates a single or multi-channel PCM(pulse code modulated) audio stream 40.

In an exemplary embodiment as shown in FIGS. 3 and 4, the audio encoder20 splits each audio sample into a MSB portion 42 and a LSB portion 44(step 46). The boundary point 48 that separates the audio data iscomputed by first assigning a minimum MSB bit width (Min MSB) 50 thatestablishes a minimum coding level for each audio sample. For example,if the bit width 52 of the audio data is 20-bit the Min MSB might be16-bit. It follows that the maximum LSB bit width (Max LSB) 54 is theBit Width 52 minus the Min MSB 50. The encoder computes a cost function,e.g. the L₂ or L_(∞) norms, for the audio data in the analysis window.If the cost function exceeds a threshold, the encoder calculates an LSBbit width 56 of at least one bit and no more than Max LSB. If the costfunction does not exceed the threshold, the LSB bit width 56 is set tozero bits. In general, the MSB/LSB split is done for each analysiswindow. As described above, this is typically one or more frames. Thesplit can be further refined for each data segment, channel set, channelor frequency extension, for example. More refinement improves codingperformance at the cost of additional computations and more overhead inthe bitstream.

The encoder losslessly encodes the MSB portions (step 58) and LSBportions (step 60) with different lossless algorithms. The audio data inthe MSB portions is typically highly correlated both temporally withinany one channel and between channels. Therefore, the lossless algorithmsuitably employs entropy coding, fixed prediction, adaptive predictionand joint channel decorrelation techniques to efficiently code the MSBportions. A suitable lossless encoder is described in copendingapplication “Lossless Multi-Channel Audio Codec” filed on Aug. 4, 2004(Ser. No. 10/911,067), which is hereby incorporated by reference. Othersuitable lossless encoders include MLP (DVD Audio), Monkey's audio(computer applications), Apple lossless, Windows Media Pro lossless,AudioPak, DVD, LTAC, MUSICcompress, OggSquish, Philips, Shorten, Sonarcand WA. A review of many of these codecs is provided by Mat Hans, RonaldSchafer “Lossless Compression of Digital Audio” Hewlett Packard, 1999.

Conversely, the audio data in the LSB portion is highly uncorrelated,closer to noise. Therefore sophisticated compression techniques arelargely ineffective and consume processing resources. Furthermore, toefficiently author the bitstream, a very simple lossless code usingsimplistic prediction of very low order followed by a simple entropycoder is highly desirable. In fact, the currently preferred algorithm isto encode the LSB portion by simply replicating the LSB bits as is. Thiswill allow individual LSBs to be discarded without having to decode theLSB portion.

The encoder separately packs the encoded MSB and LSB portions into ascalable, lossless bitstream 62 so that they can be readily unpacked anddecoded (step 64). In addition to the normal header information, theencoder packs the LSB bit width 56 into the header (step 66). The headeralso includes space for an LSB bit width reduction 68, which is not usedduring encode. This process is repeated for each analysis window(frames, frame, segment, channel set or frequency extension) for whichthe split is recalculated.

As shown in FIGS. 5, 6 and 7, the authoring tool 30 allows a user tomake a first pass at laying out the audio and video bitstreams on themedia in accordance with the decoder's buffer capacity (step 70) tosatisfy the media's peak bit rate constraint. The authoring tool startsthe analysis window loop (step 71), calculates an buffered payload (step72) and compares the buffered payload to the allowed payload for theanalysis window 73 to determine whether the lossless bitstream requiresany scaling to satisfy the constraints (step 74). The allowed payload isdetermined by buffer capacity of the audio decoder and the peak bit rateof the media or channel. The encoded payload is determined by the bitwidth of the audio data and the number of samples in all of the datasegments 75 plus the header 76. If the allowed payload is not exceeded,the losslessly encoded MSB and LSB portions are packed into respectiveMSB and LSB areas 77 and 78 of the data segments 75 in a modifiedbitstream 79 (step 80). If the allowed payload is never exceeded, thelossless bitstream is transferred directly to the media or channel.

If the buffered payload exceeds the allowed payload, the authoring toolpacks the headers and losslessly encoded MSB portions 42 into themodified bitstream 79 (step 81). Based on a prioritization rule, theauthoring tool calculates an LSB bit width reduction 68 that will reducethe encoded payload, hence buffered payload to at most the allowedpayload (step 82). Assuming the LSB portions were simply replicatedduring lossless encoding, the authoring tool scales the LSB portions(step 84) by preferably adding dither to each LSB portion so as todither the next LSB bit past the LSB bit width reduction, and thenshifting the LSB portion to the right by the LSB bit width reduction todiscard bits. If the LSB portions were encoded, they would have to bedecoded, dithered, shifted and reencoded. The tool packs the now lossyencoded LSB portions for the now conforming windows into the bitstreamwith the modified LSB bit widths 56 and the LSB bit width reduction 68and a dither parameter (step 86).

As shown in FIG. 6, the LSB portion 44 has been scaled from a bit widthof 3 to a modified LSB bit width 56 of 1-bit. The two discarded LSBs 88match the LSB bit width reduction 68 of 2 bits. In the exemplaryembodiment, the modified LSB bit width 56 and LSB bit width reduction 68are transmitted in the header to the decoder. Alternately, either ofthese could be omitted and the original LSB bit width transmitted. Anyone of the parameters is uniquely determined by the other two.

The benefits of the scalable, lossless encoder and authoring tool arebest illustrated by overlaying the buffered payload 90 for the authoredbitstream on FIG. 1 as is done in FIG. 8. Using the known approach ofaltering the audio files to remove content and then simply reencodingwith the lossless coder, the buffered payload 14 was effectively shifteddownward to a buffered payload 16 that is less than the allowed payload10. To ensure that the peak payload is less than the allowed payload, aconsiderable amount of content is sacrificed across the entirebitstream. By comparison, the buffered payload 90 replicates theoriginal losslessly buffered payload 14 except in those few windows(frames) where the buffered payload exceeds the allowed payload. Inthese areas, the encoded payload, hence buffered payload is reduced justenough to satisfy the constraint and preferably no more. As a result,the payload capacity is utilized more efficiently and more content isdelivered to the end user without having to alter the original audiofiles or reencode.

As shown in FIGS. 9, 10 and 11, the audio decoder 38 receives anauthored bitstream via a disk 100. The bitstream is separated into asequence of analysis windows, each including header information andencoded audio data. Most of the windows include losslessly encoded MSBand LSB portions, the original LSB bit widths and LSB bit widthreductions of zero. To satisfy the payload constraints set by the peakbit rate of the disk 100 and the capacity of the buffer 102, some of thewindows include the losslessly encoded MSB portions and lossy LSBportions, the modified bit widths of the lossy LSB portions, and the LSBbit width reductions.

A controller 104 reads the encoded audio data from the bitstream on thedisk 100. A parser 106 separates the audio data from the video andstreams the audio data to the audio buffer 102, which does not overflowon account of the authoring. The buffer in turn provides sufficient datato a DSP chip 108 to decode the audio data for the current analysiswindow. The DSP chip extracts the header information (step 110)including the modified LSB bit widths 56, LSB bit width reduction 68, anumber of empty LSBs 112 from an original word width and extracts,decodes and assembles the MSB portions of the audio data (step 114). Ifall of the LSBs were discarded during authoring or original LSB bitwidth was 0 (step 115), the DSP chip translates the MSB samples to theoriginal bit width word and outputs the PCM data (step 116). Otherwise,the DSP chip decodes the lossless and lossy LSB portions (step 118),assembles the MSB & LSB samples (step 120), and, using the headerinformation, translates the assembled samples to the original bit widthword (step 122).

Multi-Channel Audio Codec & Authoring Tool

An exemplary embodiment of an audio codec and authoring tool for anencoded audio bitstream presented as a sequence of frames is illustratedin FIGS. 12-15. As shown in FIG. 12, each frame 200 comprises a header202 for storing common information 204 and sub-headers 206 for eachchannel set that store the LSB bit widths and LSB bit width reductions,and one or more data segments 208. Each data segment comprises one ormore channel sets 210 with each channel set comprising one or more audiochannels 212. Each channel comprises one or more frequency extensions214 with at least the lowest frequency extension including encoded MSBand LSB portions 216, 218. The bitstream has a distinct MSB and LSBsplit for each channel in each channel set in each frame. The higherfrequency extensions may be similarly split or entirely encoded as LSBportions.

The scalable lossless bitstream from which this bitstream is authored isencoded as illustrated in FIGS. 13 a and 13 b. The encoder sets the bitwidth of the original word (24-bit), the Min MSB (16-bit), a threshold(Th) for the squared L2 norm and a scale factor (SF) for that norm (step220). The encoder starts the frame loop (step 222) and the channel setloop (step 224). Because the actual width of the audio data (20-bit) maybe less than the original word width, the encoder calculates the numberof empty LSBs (24−20=4)(min number of “0” LSBs in any PCM sample in thecurrent frame) and right shifts every sample by that amount (step 226).The bit width of the data is the original bit width (24) minus thenumber of empty LSBs (4) (step 228). The encoder then determines themaximum number of bits (Max LSBs) that will allow to be encoded as partof the LSB portion as Max(Bit Width−Min MSB, 0) (step 230). In thecurrent example, the Max LSBS=20−16=4 bits.

To determine the boundary point for splitting the audio data into MSBand LSB portions, the encoder starts the channel loop index (step 232)and calculates the L_(∞) norm as the maximum absolute amplitude of theaudio data in the channel and the squared L2 norm as the sum of thesquared amplitudes of the audio data in the analysis window (step 234).The encoder sets a parameter Max Amp as the minimum integer greater thanor equal to log₂(L_(∞)) (step 236) and initializes the LSB bit width tozero (step 237). If the Max Amp is greater than the Min MSB (step 238),the LSB bit width is set equal to the difference of the Max Amp and MinMSB (step 240). Otherwise, if the L2 norm exceeds the Threshold (smallamplitude but considerable variance) (step 242), the LSB bit width isset equal to the Max Amp divided by the Scale Factor, typically>1 (step244). If both tests are false, the LSB bit width remains zero. In otherwords, to maintain the minimum encode quality, e.g. Min MSB, no LSBs areavailable. The encoder clips the LSB bit width at the Max LSB value(step 246) and packs the value into the sub-header channel set (step248).

Once the boundary point has been determined, i.e. the LSB bit width, theencoder splits the audio data into the MSB and LSB portions (step 250).The MSB portion is losslessly encoded using a suitable algorithm (step252) and packed into the lowest frequency extension in the particularchannel in the channel set of the current frame (step 254). The LSBportion is losslessly encoded using a suitable algorithm, e.g. simplebit replication (step 256) and packed (step 258).

This process is repeated for each channel (step 260) for each channelset (step 262) for each frame (step 264) in the bitstream. Furthermore,the same procedure may be repeated for higher frequency extensions.However, because these extensions contain much less information, the MinMSB may be set to 0 so that it is all encoded as LSBs.

Once the scalable lossless bitstream is encoded for certain audiocontent, an authoring tool creates the best bitstream it can thatsatisfies the peak bit rate constraints of the transport media and thecapacity of the buffer in the audio decoder. As shown in FIG. 14, a userattempts to layout the lossless bitstream 268 on the media to conform tothe bit rate and buffer capacity constrains (step 270). If successful,the lossless bitstream 268 is written out as the authored bitstream 272and stored on the media. Otherwise the authoring tool starts the frameloop (step 274) and compares the buffered payload (buffered averageframe-to-frame payload) to the allowed payload (peak bit rate) (step276). If the current frame conforms to the allowed payload, thelosslessly encoded MSB and LSB portions are extracted from the losslessbitstream 268 and written to the authored bitstream 272 and the frame isincremented.

If the authoring tool encounters a non-conforming frame in which thebuffered payload exceeds the allowed payload, the tool computes themaximum reduction that can be achieved by discarding all of the LSBportions in the channel set and subtracts it from the buffered payload(step 278). If the minimum payload is still too big the tool displays anerror message that includes the amount of excess data and frame number(step 280). In this case either the Min MSB shall be reduced or theoriginal audio files shall be altered and re-encoded.

Otherwise, the authoring tool calculates an LSB bit width reduction foreach channel in the current frame based on a specified channelprioritization rule (step 282) such that:

Bit Width Reduction[nCh]<LSB bit width[nCh] for nCh=0, . . .AllChannels−1,

and

Buffered payload[nFr]−Σ(Bit Width Reduction[nCh}*NumSamplesinFrame)<Allowed Payload[nFr]

The reduction of the LSB bit widths by these values will ensure that theframe conforms to the allowed payload. This is done with a minimumamount of loss being introduced into the non-conforming frames andwithout otherwise affecting the lossless conforming frames.

The authoring tool adjusts the encoded LSB portions (assuming bitreplication encoding) for each channel by adding dither to each LSBportion in the frame to dither the next bit and then right shifting bythe LSB bit width reduction (step 284). Adding dither is not necessarybut is highly desirable in order to decorrelate the quantization errorsand also make them decorrelated from the original audio signal. The toolpacks the now lossy scaled LSB portions (step 286), the modified LSB bitwidths and LSB bit width reductions for each channel (step 288) and themodified stream navigation points (step 290) into the authoredbitstream. If dither is added, a dither parameter is packed into thebitstream. This process is then repeated for each frame (step 292)before terminating (step 294).

As shown in FIGS. 15 a and 15 b, a suitable decoder synchronizes to thebitstream (step 300) and starts a frame loop (step 302). The decoderextracts the frame header information including the number of segments,number of samples in a segment, number of channel sets, etc (step 304)and extracts the channel set header information including the numberchannels in the set, number of empty LSBs, LSB bit width, LSB bit widthreduction for each channel set (step 306) and stores it for each channelset (step 307).

Once the header information is available, the decoder starts the segmentloop (step 308) and channel set loop (step 310) for the current frame.The decoder unpacks and decodes the MSB portions (step 312) and storesthe PCM samples (step 314). The decoder then starts the channel loop inthe current channel set (step 316) and proceeds with the encoded LSBdata.

If the modified LSB bit width does not exceed zero (step 318), thedecoder starts the sample loop in the current segment (step 320),translates the PCM samples for the MSB portion to the original wordwidth (step 322) and repeats until the sample loop terminates (step324).

Otherwise, the decoder starts the sample loop in the current segment(step 326), unpacks and decodes the LSB portions (step 328) andassembles PCM samples by appending the LSB portion to the MSB portion(step 330). The decoder then translates the PCM sample to the originalword width using the empty LSB, modified LSB bit width and LSB bit widthreduction information from the header (step 332) and repeats the stepsuntil the sample loop terminates (step 334). To reconstruct the entireaudio sequence, the decoder repeats these steps for each channel (step336) in each channel set (step 338) in each frame (step 340).

Backward Compatible Scalable Audio Codec

The scalability properties can be incorporated into a backwardcompatible lossless encoder, bitstream format and decoder. A “lossy”core code stream is packed in concert with the losslessly encoded MSBand LSB portions of the audio data for transmission (or recording). Upondecoding in a decoder with extended lossless features, the lossy andlossless MSB streams are combined and the LSB stream is appended toconstruct a lossless reconstructed signal. In a prior-generationdecoder, the lossless MSB and LSB extension streams are ignored, and thecore “lossy” stream is decoded to provide a high-quality, multichannelaudio signal with the bandwidth and signal-to-noise ratio characteristicof the core stream.

FIG. 16 a shows a system level view of a scalable backward compatibleencoder 400. A digitized audio signal, suitably M-bit PCM audio samples,is provided at input 402. Preferably, the digitized audio signal has asampling rate and bandwidth which exceeds that of a modified, lossy coreencoder 404. In one embodiment, the sampling rate of the digitized audiosignal is 96 kHz (corresponding to a bandwidth of 48 kHz for the sampledaudio). It should also be understood that the input audio may be, andpreferably is, a multichannel signal wherein each channel is sampled at96 kHz. The discussion which follows will concentrate on the processingof a single channel, but the extension to multiple channels isstraightforward. The input signal is duplicated at node 406 and handledin parallel branches. In a first branch of the signal path, a modifiedlossy, wideband encoder 404 encodes the signal. The modified coreencoder 404, which is described in detail below, produces an encodeddata stream (corestream 408) which is conveyed to a packer ormultiplexer 410. The corestream 408 is also communicated to a modifiedcorestream decoder 412, which produces as output a modified,reconstructed core signal 414, which is right shifted by N bits (>>N415) to discard its N lsbs.

Meanwhile, the input digitized audio signal 402 in the parallel pathundergoes a compensating delay 416, substantially equal to the delayintroduced into the reconstructed audio stream (by modified encode andmodified decoders), to produce a delayed digitized audio stream. Theaudio stream is split into MSB and LSB portions 417 as described above.The N-bit LSB portion 418 is conveyed to the packer 410. The M-N bitreconstructed core signal 414, which was shifted to align with the MSBportion, is subtracted from the MSB portion of the delayed digitizedaudio stream 419 at subtracting node 420. (Note that a summing nodecould be substituted for a subtracting node, by changing the polarity ofone of the inputs. Thus, summing and subtracting may be substantiallyequivalent for this purpose).

Subtracting node 420 produces a difference signal 422 which representsthe difference between the M-N MSBs of the original signal and thereconstructed core signal. To accomplish purely “lossless” encoding, itis necessary to encode and transmit the difference signal with losslessencoding techniques. Accordingly, the M-N bit difference signal 422 isencoded with a lossless encoder 424, and the encoded M-N bit signal 426packed or multiplexed with the core stream 408 in packer 410 to producea multiplexed output bitstream 428. Note that the lossless codingproduced coded lossless streams 418 and 426 which are at a variable bitrate, to accommodate the needs of the lossless coder. The packed streamis then optionally subjected to further layers of coding includingchannel coding, and then transmitted or recorded. Note that for purposesof this disclosure, recording may be considered as transmission througha channel.

The core encoder 404 is described as “modified” because in an embodimentcapable of handling extended bandwidth the core encoder would requiremodification. A 64-band analysis filter bank within the encoder discardshalf of its output data and encodes only the lower 32 frequency bands.This discarded information is of no concern to legacy decoders thatwould be unable to reconstruct the upper half of the signal spectrum inany case. The remaining information is encoded as per the unmodifiedencoder to form a backwards-compatible core output stream. However, inanother embodiment operating at or below 48 kHz sampling rate, the coreencoder could be a substantially unmodified version of a prior coreencoder. Similarly, for operation above the sampling rate of legacydecoders, the core decoder 412 would need to be modified as describedbelow. For operation at conventional sampling rate (e.g., 48 kHz andbelow) the core decoder could be a substantially unmodified version of aprior core decoder or equivalent. In some embodiments the choice ofsampling rate could be made at the time of encoding, and the encode anddecode modules reconfigured at that time by software as desired.

As shown in FIG. 16 b, the method of decoding is complementary to themethod of encoding. A prior generation decoder can decode the lossy coreaudio signal by simply decoding the corestream 408 and discarding thelossless MSB and LSB portions. The quality of audio produced in such aprior generation decoder will be extremely good, equivalent to priorgeneration audio, just not lossless.

Referring now to FIG. 16 b, the incoming bitstream (recovered fromeither a transmission channel or a recording medium) is first unpackedin unpacker 430, which separates the corestream 408 from losslessextension data streams 418 (LSB) and 426 (MSB). The core stream isdecoded by a modified core decoder 432, which reconstructs the corestream by zeroing out the un-transmitted sub-band samples for the upper32 bands in a 64-band synthesis during reconstruction. (Note, if astandard core encode was performed, the zeroing out is unnecessary). TheMSB extension field is decoded by a lossless MSB decoder 434. Becausethe LSB data was losslessly encoded using bit replication no decoding isnecessary.

After decoding core and lossless MSB extensions in parallel, with theinterpolated core reconstructed data is right shifted by N bits 436 andcombined with the lossless portion of the data by adding in summer 438.The summed output is left shifted by N bits 440 to form the lossless MSBportion 442 and assembled with the N-bit LSB portion 444, to produce aPCM data word 446 that is a lossless, reconstructed representation ofthe original audio signal 402.

Because the signal was encoded by subtracting a decoded, lossyreconstruction from the exact input signal, the reconstructed signalrepresents an exact reconstruction of the original audio data. Thus,paradoxically, the combination of a lossy codec and a losslessly codedsignal actually performs as a pure lossless codec, but with theadditional advantage that the encoded data remains compatible with priorgeneration, lossless decoders. Furthermore, the bitstream can be scaledby selectively discarding LSBs to make it conform to media bit rateconstraints and buffer capacity.

While several illustrative embodiments of the invention have been shownand described, numerous variations and alternate embodiments will occurto those skilled in the art. Such variations and alternate embodimentsare contemplated, and can be made without departing from the spirit andscope of the invention as defined in the appended claim

18. A method of encoding a scalable, lossless bitstream for audio data,comprising: determining a breakpoint that separates audio data into anMSB and an LSB portion for an analysis window; losslessly encoding theMSB portions; losslessly encoding the LSB portions; packing the encodedMSB portions and LSB portions into a lossless bitstream; and packing thebit widths of the LSB portions into the lossless bitstream.
 19. Themethod of claim 18, wherein the breakpoint is determined by; Assigning aminimum MSB bit width (Min MSB); Computing a cost function for the audiodata in the analysis window; If the cost function exceeds a threshold,computing an LSB bit width of at least one bit that satisfies the MINand MSB; and If the cost function does not exceed the threshold,assigning the LSB bit width to be zero bits.
 20. The method of claim 18,wherein the LSB portions are encoded with a lossless algorithm thatreplicates the bits of the audio data.
 36. The method of claim 18,wherein an LSB bit width and the encoded MSB and LSB portions are packedinto a bitstream for each analysis window.
 37. The method of claim 18,wherein the MSB portion is encoded with a lossless algorithm thatincludes decorrelation between multiple audio channels and adaptiveprediction within each audio channel.
 38. The method of claim 18,wherein the LSB portion is encoded with a lossless algorithm that useslow order prediction and entropy coding.
 39. The method of claim 18,wherein the analysis windows are frames, each frame comprising a headerfor storing the LSB bit widths and one or more segments, each segmentcomprising one or more channel sets, each channel set comprising one ormore audio channels, each channel comprising one or more frequencybands, said frequency bands including encoded MSB and LSB portions. 40.The method of claim 39, wherein the bitstream has a distinct MSB and LSBsplit for each frequency band in each channel set in each frame.
 41. Themethod of claim 39, wherein said higher frequency bands include onlyencoded LSB portions.